// npm install canvas
const { createCanvas, loadImage } = require('canvas');
const fs = require('fs');

// 设置画布大小
const width = 256;
const height = 256;

// 创建画布
const canvas = createCanvas(width, height);
const ctx = canvas.getContext('2d');

// 绘制背景圆
ctx.beginPath();
ctx.arc(width / 2, height / 2, Math.min(width, height) / 2 - 10, 0, Math.PI * 2);
ctx.fillStyle = '#4CAF50';
ctx.fill();

// 添加文字
ctx.font = 'bold 36px Arial';
ctx.fillStyle = 'white';
ctx.textAlign = 'center';
ctx.textBaseline = 'middle'; // 确保文本垂直居中
ctx.fillText('🔔', width / 2, height / 2);

// 保存图像到文件
const out = fs.createWriteStream(__dirname + '/icon.png');
const stream = canvas.createPNGStream();
stream.pipe(out);
out.on('finish', () => console.log('The icon has been saved as icon.png'));



